import {request} from '@umijs/max';
import * as API from "@/services";


/** 专家作者 分页检索请求 */
export async function queryAuthors(params: API.AuthorPageQueryParams): Promise<API.RespPageResult<API.Author>> {
  return request('/api/v1/author', {
    params,
  });
}

/** 专家作者 详情请求 */
export async function queryAuthor(bizId: API.EntityId): Promise<API.RespResult<API.Author>> {
  return request(`/api/v1/author/${bizId}`);
}

/** 专家作者 创建请求 */
export async function createAuthor(entity: API.Author_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/author`, {
    method: 'POST',
    data: entity,
  });
}

/** 专家作者 修改请求 */
export async function modifyAuthor(entity: API.Author_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/author/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 专家作者 修改(部分)请求 */
export async function patchAuthor(entity: API.Author_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/author/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 专家作者 删除请求 */
export async function deleteAuthor(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/author/${bizId}`, {
    method: 'DELETE',
  });
}

/** 专家作者 批量删除请求 */
export async function deleteAuthors(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/author`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}
